<?php
class coltypes_model extends CI_Model{
		public $model;
		function __construct(){
			$this->model='coltypes';
		}
		
		/*
		 * 获取新闻的分类头部
		 */
		public function get_nav($cid){
			$query=$this->db->order_by('sort_id','asc')->get_where($this->model,array('cid'=>$cid))->result_array();
			if(!empty($query)){
				foreach($query as $k=>$v){
					if(!empty($v['photo'])){
						$query[$k]['img']=$this->db->get_where('upload',array('id'=>$v['photo']))->row_array();
					}
				}
			}
			return $query;
		}
}